package com.chuangjiangx.member.coupon.ddd.domain.model;

/**
 * 会员卡封面选项枚举
 *
 * @author wp
 * @create 2018-08-28 14:56
 **/
public enum CardCoverEnum {

    NULL("未选择",0),
    COLOUR("背景色",1),
    PICTURE("背景图",2)
    ;

    public String name;
    public Integer code;

    CardCoverEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static CardCoverEnum fromCode(Integer code){
        for(CardCoverEnum cardCoverEnum:CardCoverEnum.values()){
            if(code.equals(cardCoverEnum.code)){
                return cardCoverEnum;
            }
        }
        throw new IllegalStateException("不存在 该封面选项:  "+code);
    }
}
